package com.example.borui.partpositionproject.simple.bean;

import android.text.TextUtils;

import com.example.borui.partpositionproject.partpisition.view.IPartPositionBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by borui on 2017/9/29.
 */

public class DataBean implements IPartPositionBean {

    /***
     * @pqrams 1 类型1 是显示一个itemview
     * @params 2 类型 显示并排 两个itemView
     * @params 3 类型 显示并排 三个itemview
     * @params 4 类型 显示带 标题和底部view 的 itemView 中间是大图
     * @params 5 类型 显示集群
     */
    private int type;

    private String picUrl;

    private String textContent;

    private List<DataBean> dataChildBeans;

    private boolean isCluster = false;

    public boolean isCluster() {
        return isCluster;
    }

    public void setCluster(boolean cluster) {
        isCluster = cluster;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getPicUrl() {
        return picUrl;
    }

    public List<DataBean> getDataChildBeans() {
        return dataChildBeans;
    }

    public void setDataChildBeans(List<DataBean> dataChildBeans) {
        this.dataChildBeans = dataChildBeans;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }

    public String getTextContent() {
        if(!TextUtils.isEmpty(textContent)){
            return textContent;
        }

        switch (type){
            case 1:
                return "第一个分类";
            case 2:
                return "第二个分类";
            case 3:
                return "第三个分类";
            case 4:
                return "第四个分类";
            case 5:
                return "第五个分类";
        }
        return "不存在这个分类";
    }

    public void setTextContent(String textContent) {
        this.textContent = textContent;
    }

    @Override
    public int getPartPositionType() {
        return type;
    }

    @Override
    public List<IPartPositionBean> getChildBeans() {
        List<IPartPositionBean> iPartPositionBeans = new ArrayList<>();
        if(null != dataChildBeans && dataChildBeans.size() > 0){
            iPartPositionBeans.addAll(dataChildBeans);
        }
        return iPartPositionBeans;
    }
}
